const  mongoose=require('mongoose');
mongoose.connect("mongodb://127.0.0.1:27017/Sings");
const  db=mongoose.connection;

db.on('error',(error)=>{
    console.log('mongo error is:'+error);
});
db.on('open',()=>{
    console.log("connection successed");
});
//登录注册模型
const  LoginSchema= new mongoose.Schema({
    name:String,
    pass:String
},{versionKey:false})
//注册模型
// const RegisterSchema=new mongoose.Schema({
//     name:String,
//     password:String
// },{versionKey:false})
const  SingSchema=new mongoose.Schema({
    singName:String,
    singer:String,
    singAlbum:String,
    singType:String,
},{versionKey:false});

const Models={
    login:mongoose.model("user",LoginSchema),
    // register:mongoose.model("register",RegisterSchema)
    sing:mongoose.model("sing",SingSchema),
}

module.exports=Models
